﻿using BW.WMS.Application.Features.Product.Dtos;
using BW.WMS.Application.Features.Product.Interfces;
using BW.WMS.Application.Features.Product.Services;
using BW.WMS.Core.Result;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BW.WMS.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProductlitsController : ControllerBase
    {
        private readonly IProductService _productServices;

        public ProductlitsController(IProductService productServices)
        {
            _productServices = productServices;
        }


        /// <summary>
        /// 货品信息分页查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 

        [HttpGet]
        public async Task<ApiPage<ProductWithTypeDto>> GetProductList([FromQuery]InputProductDtos input)
        {
            return await _productServices.GetProductList(input);
        }



        /// <summary>
        /// 新增货品信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreateProduct(ProductInputDto input)
        {
            return await _productServices.CreateProduct(input);
        }

    }
}
